import HTMLTestRunner_cn,yagmail,logging,time


class Tools():
    def Log(self):
        log1 = logging.basicConfig(level=logging.DEBUG,
                                   format='%(levelname)s %(message)s %(filename)s %(asctime)s %(lineno)d ',
                                   filename='jiuxian.log',
                                   filemode='a+')
        return log1

    def html(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open('jiuxian.html','wd'),
                                                  title='测试报告',
                                                  description='测试报告')
        return report

    def email(self):
        et = time.strftime('%Y%m%d%H%M', time.localtime())
        email = yagmail.SMTP(user='2031077871@qq.com',password='knnftuvjposdcjbi',smtp='smtp.qq.com')
        email.send(to='2031077871@qq.com',subject=et+'测试报告',contents=et+'测试报告')
        email.close()